$(function() {
    $('#myOrderTab').bootstrapTable({
        method : 'post',
        url : "/selMyOrder",//请求路径
        striped : true, //是否显示行间隔色
        pageNumber : 1, //初始化加载第一页
        pagination : true,//是否分页
        sidePagination : 'client',//server:服务器端分页|client：前端分页
        pageSize : 5,//单页记录数
        pageList : [ 5, 10, 15, 20 ],//可选择单页记录数
        showRefresh : true,//刷新按钮
        clickToSelect: true,  //自动选中或取消复选框
        onClickRow:function (row,$element) {
            //window.location.href="/goItemDetail?id="+row.id;
            showDetail(row.id);
        },
        queryParams : function(params) {//上传服务器的参数
            var userId = $("#userId").val();
            return userId;
        },
        //只需加入下面这个checkbox，就会在第一列显示复选框
        columns : [ /*{
            checkbox: true
        },*/
            {
                title : '订单编号',
                field : 'id',
                align : 'center',
                visible:false,
            },
            {
                title : '商品名称',
                field : 'itemBo.title',
                align : 'center',
            }, {
                title : '购买数量',
                field : 'itemAmount',
                align : 'center',
            }, {
                title : '消费金额',
                field : 'orderPrice',
                align : 'center',
            }, {
                title : '下单时间',
                field : 'orderTime',
                align : 'center',
                formatter : function(value, row, index) {
                    var time=new Date(value);
                    var month=1+time.getMonth();
                    var uptime=time.getFullYear();
                    if(month<=9){
                        uptime=uptime+"-0"+ month;
                    }else{
                        uptime=uptime+"-"+ month;
                    }
                    if(time.getDate()<=9){
                        uptime=uptime+"-0"+time.getDate();
                    }else{
                        uptime=uptime+"-"+time.getDate();
                    }
                    if(time.getHours()<=9){
                        uptime=uptime+"  0"+time.getHours()+":";
                    }else{
                        uptime=uptime+" "+time.getHours()+":";
                    }
                    if(time.getMinutes()<=9){
                        uptime=uptime+"0"+time.getMinutes();
                    }else{
                        uptime=uptime+time.getMinutes();
                    }
                    if(time.getSeconds()<=9){
                        uptime=uptime+":0"+time.getSeconds();
                    }else{
                        uptime=uptime+":"+time.getSeconds();
                    }
                    return uptime;
                },
            }, ]
    })
});
